<?php

class Model_File
{
    
    function getById($id) {
        $sql = 'SELECT * FROM `files` WHERE `id` = ?';
        return db::fetch($sql, array((int)$id));
    }
    
    function add($data) {
        $artist = $data['artist'];
        $title = $data['title'];
        $tags = $data['tags'];
        $filecode = $data['filecode'];
        $sql = 'INSERT INTO `files` (`artist`, `title`, `filecode`)';
        db::execute($sql, array($artist, $title, $filecode));
        foreach($tags as $tag) {
            $sql = 'INSERT INTO `tags` (`file_id`, `tag_id`)';
        }
    }
    
}
